#ifndef CHANGE_RAW_CHEAT_DLG_H
#define CHANGE_RAW_CHEAT_DLG_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "../client/ClientProfileManager.h"
class ChangeRawCheatDlg : public CDialogImpl<ChangeRawCheatDlg>
{
	CEdit ctrlCheat;
	CComboBox ctrlRaw;
public:
	int raw;
	string cheatingDescription;
	string name;
	bool multiEdit;

	enum { IDD = IDD_RAW_CHEAT };
	
	BEGIN_MSG_MAP(ChangeRawCheatDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_SETFOCUS, onFocus)
		COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
		COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
	END_MSG_MAP()
	
	ChangeRawCheatDlg() : multiEdit(false) { };
	
	LRESULT onFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
		ctrlCheat.SetFocus();
		return FALSE;
	}

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	{
		ctrlCheat.Attach(GetDlgItem(IDC_CHEAT));
		ctrlCheat.SetFocus();
		ctrlCheat.SetWindowText(cheatingDescription.c_str());

		if(multiEdit){
			::EnableWindow(GetDlgItem(IDC_CHEAT), false);
		}
		ctrlRaw.Attach(GetDlgItem(IDC_CHANGE_RAW));
		//Sulan start svn209
		for(int n=0;n<11;){
			ctrlRaw.AddString(RAWSETTING(n).c_str());
			++n;
		}
		//End
		ctrlRaw.SetCurSel(raw);
		SetWindowText(name.c_str());
		
		CenterWindow(GetParent());
		return FALSE;
	}
	
	LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
	{
		if(wID == IDOK) {
			int len = ctrlCheat.GetWindowTextLength() + 1;
			TCHAR* buf = new TCHAR[len];
			GetDlgItemText(IDC_CHEAT, buf, len);
			cheatingDescription = buf;
			delete[] buf;
			raw = ctrlRaw.GetCurSel();
		}
		EndDialog(wID);
		return 0;
	}
	
};

#endif // CHANGE_RAW_CHEAT_DLG_H